package com.jcl.recruit.api.searchresume.controller;

import com.jcl.core.resp.ApiResponse;
import com.jcl.recruit.crawler.service.CrawlerResumeBaseService;
import com.jcl.recruit.searchresume.model.SearchResume;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Map;

@RestController
@RequestMapping("/api/searchresume")
public class SearchResumeBaseController {

    @Autowired
    private CrawlerResumeBaseService crawlerResumeBaseService;

    @RequestMapping(value = "/save",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    public ApiResponse searchResumeSave(@RequestBody Map<String,String> entity){
        ApiResponse response = new ApiResponse();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        SearchResume searchResume = crawlerResumeBaseService.exportSearchResume(entity);
        response.setMsg("操作成功");
        response.setData(searchResume);
        return response;
    }

    @RequestMapping(value = "/worksave",method = RequestMethod.POST)
    public ApiResponse searchresumeWorksave(@RequestBody Map<String,String> entity){
        ApiResponse response = new ApiResponse();
        crawlerResumeBaseService.exportSearchResumeWork(entity);
        response.setMsg("操作成功");
        return response;
    }

    @RequestMapping(value = "/edusave",method = RequestMethod.POST)
    public ApiResponse searchresumeEdusave(@RequestBody Map<String,String> entity){
        ApiResponse response = new ApiResponse();
        crawlerResumeBaseService.exportSearchresumeEdu(entity);
        response.setMsg("操作成功");
        return response;
    }

    @RequestMapping(value = "/projectsave",method = RequestMethod.POST)
    public ApiResponse searchresumeProjectsave(@RequestBody Map<String,String> entity){
        ApiResponse response = new ApiResponse();
        crawlerResumeBaseService.exportSearchResumeProject(entity);
        response.setMsg("操作成功");
        return response;
    }

}
